//locked
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#ifdef LOCAL
#define debug(...) (void(0))
#else
#define debug(...) (void(0))
#endif
typedef long long LL;
struct node{
	int i,v;
	bool operator<(node b)const{return v!=b.v?v<b.v:i<b.i;}
};
int n,m;
node a[8010];
int ans[8010];
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d",&a[i].v),a[i].i=i;
	stable_sort(a+1,a+n+1);
	for(int i=1;i<=n;i++) ans[a[i].i]=i;
	for(int i=1;i<=m;i++){int op,x,v;
		scanf("%d",&op);
		if(op==1){
			scanf("%d%d",&x,&v);
			int pos=0;
			for(int i=1;i<=n&&!pos;i++) if(a[i].i==x) pos=i;
			a[pos].v=v;
			while(1<pos&&a[pos]<a[pos-1]) swap(a[pos-1],a[pos]),pos--;
			while(pos<n&&a[pos+1]<a[pos]) swap(a[pos],a[pos+1]),pos++;
			for(int i=1;i<=n;i++) ans[a[i].i]=i;
		}else{
			scanf("%d",&x);
			printf("%d\n",ans[x]);
		}
//		debug("after i is:");
//		for(int i=1;i<=n;i++) debug("(%d,%d),",a[i].v,a[i].i);
//		debug("\n");
	}
	return 0;
}
/*
>877,332,633 >234,569,527 >229,171,089 >600,324,455 >246,345,024 >856,960,762 >574,229,391 >234,569,527 >202,374,341 >849,045,846
before <= + after < + 1
< + before == + 1
*/

